package com.magnificent.panda.settings;

import com.magnificent.panda.utils.PandaConstants;
import com.silverhaze.commons.utils.settings.JAXBUtils;

import javax.xml.bind.annotation.XmlRootElement;

/**
 * User: Babanin
 * Date: 24.02.2010
 * Time: 11:08:04
 */
@XmlRootElement(name = "settings")
public class Settings {
    private static Settings instance;

    private Settings() {
        loadSettings();
    }

    private void loadSettings() {
        try {
            instance = (Settings) JAXBUtils.loadSettings(PandaConstants.PANDA_SETTINGS_FILE_PATH,
                    new Class[]{
                            Settings.class
                    });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static Settings getInstance() {
        if (instance == null) {
            instance = new Settings();
        }

        return instance;
    }
}

  /* converted to utf8 */